package com.ihr360.payroll.config;

import com.ihr360.commons.lang.CollectionUtils;
import com.ihr360.commons.model.type.FieldSource;

import java.util.Arrays;

public class SystemSalaryFieldValueEntity extends SalaryFieldValueEntity {
    /**
     * 字段支持的取值方式列表
     */
    protected FieldSourcesEntity sources;

    /**
     * 默认字段取值方式
     */
    protected FieldSource defaultSource = FieldSource.INPUT;


    public FieldSourcesEntity getSources() {
        if (sources == null || CollectionUtils.isEmpty(sources.getData())) {
            FieldSourcesEntity sourcesEntity = new FieldSourcesEntity();
            sourcesEntity.setData(Arrays.asList(FieldSource.values()));
            return sourcesEntity;
        }
        return sources;
    }

    public void setSources(FieldSourcesEntity sources) {
        this.sources = sources;
    }

    public FieldSource getDefaultSource() {
        return defaultSource;
    }

    public void setDefaultSource(FieldSource defaultSource) {
        this.defaultSource = defaultSource;
    }
}